import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
const Layout = () => import(/* webpackChunkName: "home" */ '@/Layout/index.vue');
const Home = () => import(/* webpackChunkName: "home" */ '@/views/Home/index.vue');
const Editor = () => import(/* webpackChunkName: "editor" */ '@/views/Editor/index.vue');

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'Layout',
		component: Layout,
		children: [
			{
				path: '',
				name: 'Home',
				meta: {
					title: '首页',
				},
				component: Home,
			},
		],
	},
	{
		path: '/editor',
		name: 'Editor',
		meta: {
			title: '编辑我的作品',
		},
		component: Editor,
	}
];

const router = createRouter({
	history: createWebHashHistory(process.env.BASE_URL),
	routes,
	scrollBehavior() {
		return { left: 0, top: 0 };
	},
});

export default router;
